import request from "@/utils/request";

export interface carouselReturn {
  appAdvertiseUrl: string;
  backgroundColor: null;
  createTime: number;
  creator: string;
  id: string;
  link: string;
  linkMomentId: string;
  linkMomentSummary: string;
  pcAdvertiseUrl: string;
  position: string;
  positionDetail: any[];
  title: string;
  updateTime: number;
  videoDuration: null;
}

// 获取轮播资源
export const getCarouselRequest = () => {
  return request.get<any, carouselReturn[]>(
    "/promotion/ads/search/findByPosition?position=pc_mainpage"
  );
};

export interface contentType {
  aiyigeApplication: string;
  algorithmSortValue: number;
  avocationTags: any;
  channel: string;
  cover: any;
  createTime: number;
  creator: string;
  creatorBackup: any;
  difficultDegreeValue: number;
  editHighestVersion: string;
  enclosureCount: number;
  id: string;
  initExposureNum: number;
  mediaSummary: any;
  momentClassificationBackup: any;
  moreBackup: any;
  needPromotion: number;
  notVipPromotion: number;
  num: number;
  onsellTime: number;
  onsellUpdateTime: number;
  popTrainingIndex: number;
  router: string;
  statisticsBackup: any;
  status: number;
  subject: number;
  tags: any;
  title: string;
  updateTime: number;
  version: number;
  vipPromotion: number;
}

export interface recommendReturnType {
  content: contentType[];
  first: boolean;
  last: boolean;
  number: number;
  numberOfElements: number;
  offset: null;
  size: number;
  sort: null;
  statistics: any;
  totalElements: number;
  totalPages: number;
  useOffset: boolean;
}

// 获取推荐资源
export const getRecommendRequest = (count: number) => {
  return request.get<null, recommendReturnType>(
    `/moment/moments/rec/default?column=recommend&pageSize=${count}&pageNum=0&localCache=0`
  );
};

// 获取作品资源
export const getProductionRequest = () => {
  return request.get<null, recommendReturnType>(
    `/moment/moments/collect/original/integrated?pageSize=20&pageNum=0&column=original`
  );
};

// 选择兴趣技能列表
export const getInterestListRequest = (pageNum: number, pageSize: number) => {
  return request.get<null, any>(
    `/avocation/avocations/rec/user?pageNum=${pageNum}&pageSize=${pageSize}`
  );
};
